window.addEventListener("keydown", ev => {
  if (ev.ctrlKey && ev.code === "KeyS") {
    ev.preventDefault()
  }
})
window.addEventListener("contextmenu", ev => {
  ev.preventDefault()
})

function getQueryString(name) {
  let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
  let r = window.location.search.substring(1).match(reg);
  if (r != null) {
    return unescape(r[2]);
  }
  return null;
}

window.myLocalStorage = {
  getItem(key, def = null) {
    let res = localStorage.getItem(key)
    if (res == null) {
      return def;
    }
    return JSON.parse(res).data
  },
  setItem(key, value) {
    localStorage.setItem(key, JSON.stringify({
      time: Date.now(),
      data: value
    }))
  },
  removeItem(key) {
    localStorage.removeItem(key)
  }
}
window.mySessionStorage = {}